using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Sysgeprava.Entities;

namespace Sysgeprava.Repository.Mapping
{
    public class PROPIETARIOMap : EntityTypeConfiguration<PROPIETARIO>
    {
        public PROPIETARIOMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Dni)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.ApePaterno)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.ApeMaterno)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Nombre)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Direccion)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("PROPIETARIO");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Dni).HasColumnName("Dni");
            this.Property(t => t.ApePaterno).HasColumnName("ApePaterno");
            this.Property(t => t.ApeMaterno).HasColumnName("ApeMaterno");
            this.Property(t => t.Nombre).HasColumnName("Nombre");
            this.Property(t => t.Direccion).HasColumnName("Direccion");
        }
    }
}
